﻿using UnityEngine;
using System.Collections;

public enum ECharSize
{
	Medium,
	Small,
	Big,
}

[System.Serializable]
public class ProjectileInfo
{
	public float speed;
	public LeanTweenType tweenType;
	public float curveUpOffset;
	public string projectileResPath;
	public string projectileHitResPath;
	public string resRoot;
	public AudioClip projectileHitSound;
	public float projectileHitSoundVolume=1.0f;
	public bool shakeCamOnArrive;
}

public class BattleCharInfo : MonoBehaviour {

	public LeanTweenType moveForwardTween = LeanTweenType.easeOutSine;
	public LeanTweenType moveBackTween = LeanTweenType.linear;

	public float myRadius = 0.7f;
	/*
	public float targetPosOffset = 1.3f;//이동 공격시 타겟위치 앞 얼마나 떨어진 지점으로 갈것인지//
	*/
	public float supportAtkPosOffset = 2;
	public ECharSize charSize;
	public bool isEnterStageMove;
	public string R_Weapon_Model;
	public string R_Weapon_AttachName = "R_Weapon";
	public string L_Weapon_Model;
	public string L_Weapon_AttachName = "L_Weapon";
	public bool isCaster;
	public ProjectileInfo projectileInfo;


	//	temp code
	//	by jin-hyun
	//public CharacterShakeCameraData[]			CameraShakeDataArray = null;
	public SwiftShadow		CircleShadowLink = null;	
	bool isEnabledShadow;

	void Awake()
	{
		if(CircleShadowLink!=null)
			CircleShadowLink.enabled = false;

		projectileInfo.projectileHitSound = Resources.Load("Sound/EFX/common/hit_bow_critical", typeof(AudioClip)) as AudioClip;
		projectileInfo.projectileHitSoundVolume = 0.2f;
	}

	void Start()
	{
		ShowShadow();
	}

	public void ShowShadow()
	{
		if(ShouldShowShadow()) {
			if(CircleShadowLink!=null && !isEnabledShadow) {
				isEnabledShadow=true;
				Invoke("CoShowShadow",0.5f);
			}
		}
	}

	bool ShouldShowShadow()
	{
		if(MassiveBattle.Manager.BaseManager.Instance!=null && !MassiveBattle.Manager.BaseManager.Instance.IsRaid)
			return true;
		if(BattleManager.Instance!=null)
			return true;
		if(CharacterViewer.Instance!=null)
			return true;
		return false;
	}

	void CoShowShadow()
	{
		//	로딩 문제 때문에 특정 시간 이후에 그림자를 활성화 한다.
		//yield return new WaitForSeconds( 2.0f );
		if(ShouldShowShadow()) {
			if( CircleShadowLink != null ) {
//				Debug.Log("Circle shadow enabled");
				CircleShadowLink.enabled = true;
			}
		}
		
	}
}
